package com.beimihu.leetcode;

public class CommonPrefix {
    public String longestCommonPrefix(String[] strs) {
        int len = strs[0].length();

        String s0 = strs[0];

        for(int i = 0 ; i <len ; i++){
            char c = s0.charAt(i);
            for (String s :strs){
                if(i == s.length() || s.charAt(i) == c){
                    return s0.substring(0,i);
                }
            }
        }
        return s0;

    }
}
